#pragma once
#include"Commond.h"
#include"Pool.h"
class PageCache
{
public:
	static inline PageCache* GetInstance()
	{
		return &_sInst;
	}
	Span* NewSpan(size_t pagenum);
	Span* MapObjectToSpan(void* start);
	void ReleaseSpanToPageCache(Span* span);
	std::mutex _pageMtx;
private:
	SpanList SpanLists[NPAGES];
	ObjectPool<Span> _spanPool;
	std::unordered_map<PAGE_ID, Span*> _idSpanMap;
	PageCache()
	{}
	PageCache(const PageCache&) = delete;
	static PageCache _sInst;
};